import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/emergency_record_entity.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/emergency_plan_details_controller.dart';
import 'package:get/get.dart';

class RevisionRecordController extends GetxController {
  //外部controller
  final tapController = Get.find<EmergencyPlanDetailsController>();

  /// 记录列表
  List<EmergencyRecordEntity> dataList = [];

  @override
  void onInit() {
    super.onInit();
    // 获取基本信息
    getDetailsData();
  }

  /// 获取详情数据
  void getDetailsData() async {
    // 获取列表接口
    final res = await HttpUtil().generateGetRequest<List<EmergencyRecordEntity>>(
      Interface.getAmendmentRecords,
      queryParameters: {'emergencyId': tapController.id},
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        dataList = result.data!;
      }
      update();
    });
  }
}
